      SUBROUTINE RSTART(NN)

c	include 'tcommon.for'
	%include tcommon.for

      DATA MZERO/0/        
C     ...RESTART GAME IF NOT PRIME TIME.
      GO TO(62001,62002),NN
62001 IOK=0
      CALL QTIME(NTIME)
      CALL QDATE(NDATE)
      IYR=NDATE/1000
      IDAY=NDATE-IYR*1000
      ISTYR=77
      IDIFF=IYR-ISTYR
      ISEVEN=7
      ITOT=IDIFF/4
      ITOT=ITOT+IDIFF+IDAY-1
      ITOT=MOD(ITOT,ISEVEN)
      ITOT=ITOT+1
      IF(ITOT.EQ.1.OR.ITOT.EQ.2)GO TO 62007
      IF(ITOT.EQ.7.AND.NTIME.GE.54000)GO TO 62007
      READ(3,REC=1,ERR=62010)X1,X2,X3,X4,X5,NHOL1,NHOL2
      IF(NDATE.EQ.NHOL1.OR.NDATE.EQ.NHOL2)GO TO 62007
      IF(NTIME.GE.28800.AND.NTIME.LT.42300)GO TO 62008
      IF(NTIME.GE.46800.AND.NTIME.LT.61200)GO TO 62008
      GO TO 62011
62007 IOK=1
62011 WRITE(*,62003)
62003 FORMAT(' Restart from saved game.')
	pause ' Press return key to continue...'
      CALL BPAGE
      READ(3,REC=MMKEY)MNAME,POINTS,MPASS,X1,X2,irst,
     1  MROM,XTIME,SDATE,ENERGY,ITORP,MEN,ITRMEN(1),DVWP,EWRP,DISTPE,
     1  TRATE,RTIME,DISTGT,CODDS,EODDS,IDAMRP,TRNRGY,PJAM,SHLDF,ICLOAK,
     1  ETVEL,IETOFT,NQUAD,ITFCTR,NTSTPS,DVWP0,EWRP0,DISTP0,ETVEL0,
     1  ISHNUM,LEVEL,CODDS0,EODDS0,IDAMR0,SHLDF0,TRNRG0,PJAM0,JCE,ICE,
     1  IETOF0,DISTG0,IRANKLEFTK,LEFTR,MAXBQ,NKL
     1  ,((IGAL(I,J),I=1,10),J=1,10),((IBL(I,J),I=1,10),J=1,10),
     1  ((JGAL(I,J),I=1,10),J=1,10)

      WRITE(3,REC=MMKEY)MNAME,POINTS,MPASS,X1,X2
      WRITE(9,REC=1)MNAME,POINTS,MPASS,MMKEY
      IF(LEVEL-2)63001,63002,63003
63001 MAXKQ=3
      MAXRQ=3
      MINK=3
      MINR=3
      ICLOAK=0
      PHOLE=0.
      SNOVAP=0.
      GO TO 63003
63002 ICLOAK=0
      PHOLE=0.
      SNOVAP=0.
63003 DO 62005 I=2,20
      ITRMEN(I)=0
      ICNTL(I)=0
62005 CONTINUE
      ISTSH=0
      ISHD=0
C     ...ZERO DAMAGE ARRAY
      DO 62006  I=1,10
      IF(I.EQ.10)GO TO 62006
      IFNDS(I)=0
62006 IDMG(I)=0
      IX=RAN(IZZ)*10.+1.
      IY=RAN(IZZ)*10.+1.
      XQE=IX
      YQE=IY
      DEFL=0.
C     ...START WITH SHORT RANGE SCAN
      IDOCK=0
      PNRGY=0.
      IHWARP=0
      DDEG=0.
      PDEG=0.
      DSP=0.
      PSP=0.
      ITRUCE=0
      ITRSTP=0
      ITFIRE=0
      IHERE=0
      KLNGNS=0
      NROM=0
      NRW=1
      CALL SCAN
      RETURN
62008 WRITE(*,62009)
62009 FORMAT(' Cannot restart game during prime time.')
62010	close(3)
	close(9)
	STOP
C     ...SAVE GAME - CAN'T PLAY ANOTHER UNTIL THIS ONE FINISHED
62002 WRITE(*,62004)
62004 FORMAT(' Game Will be automatically restarted at next playing.')  4215
      READ(3,REC=MMKEY)MNAME,POINTS,MPASS,X1,X2
	irst=1
      write(3,REC=MMKEY)MNAME,POINTS,MPASS,X1,X2,irst,
     1  MROM,XTIME,SDATE,ENERGY,ITORP,MEN,ITRMEN(1),DVWP,EWRP,DISTPE,
     1  TRATE,RTIME,DISTGT,CODDS,EODDS,IDAMRP,TRNRGY,PJAM,SHLDF,ICLOAK,
     1  ETVEL,IETOFT,NQUAD,ITFCTR,NTSTPS,DVWP0,EWRP0,DISTP0,ETVEL0,
     1  ISHNUM,LEVEL,CODDS0,EODDS0,IDAMR0,SHLDF0,TRNRG0,PJAM0,JCE,ICE,
     1  IETOF0,DISTG0,IRANKLEFTK,LEFTR,MAXBQ,NKL
     1  ,((IGAL(I,J),I=1,10),J=1,10),((IBL(I,J),I=1,10),J=1,10),
     1  ((JGAL(I,J),I=1,10),J=1,10)
      write(9,REC=1)MNAME,POINTS,MPASS,MZERO
	close(3)
	close(9)
      STOP
      END
